import numpy as np
from sklearn.linear_model import SGDRegressor
import matplotlib.pyplot as plt

x = np.array([[100],[113],[90],[89],[60],[70],[50],[45],[55],[78]])
y = np.array([[301],[324],[285],[296],[200],[260],[300],[120],[180],[245]])

model = SGDRegressor(loss='huber',max_iter=5000,random_state=42)
model.fit(x,y)

y2 = model.predict(x)

plt.xlabel('面积')
plt.ylabel('售价')
plt.rcParams['font.sans-serif'] = 'Simhei'
plt.axis([40,125,100,400])

plt.scatter(x, y, s=60 ,c = 'k',marker='o')
plt.plot(x, y2, 'r-')
plt.show()